package cn.zhangyong.opengl20learn

import android.opengl.GLSurfaceView
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

/**
 * 作者：<a href="http://www.cnblogs.com/baiqiantao">张勇</a><p>
 * 创建时间：2020/5/30 21:35 <p>
 * 描述：
 * @author zy
 */
abstract class BaseActivity : AppCompatActivity() {
    private lateinit var glsv: GLSurfaceView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (!GLUtils.support20(this)) {
            finish()
            return
        }
        glsv = BaseSurfaceView(this,createRender())
        setContentView(glsv)
    }

    abstract fun createRender(): GLSurfaceView.Renderer?

    override fun onResume() {
        super.onResume()
        glsv.onResume()
    }

    override fun onPause() {
        super.onPause()
        glsv.onPause()
    }
}